




********************************************************
** Table 4
********************************************************

global data="C:\CFLs\Data\"
global outputs="C:\CFLs\Outputs\"


clear
clear matrix
clear mata

set maxvar 10000
set matsize 11000

cd "$data"

global format=`"nogap label nostar starlevels(* 0.1 ** 0.05 *** 0.01) collabels(none) cells(b(star fmt(3) label(Coef.)) se(par fmt(3) label(Std.Err.))) csv"'
global statsFEshort=`"stats(N r2, fmt(0 a2) labels("Observations" "R-squared")) "'




use "CFLs_data_panel.dta", clear 


foreach var of varlist heat_house_elec_ prop_rms_ht_ num_rms_ht_  { 
	tabstat `var' if TGH_S==0 & TGL_S==0 & TGH_T==0 & TGL_T==0 & post==0, stat(mean N) 
	}


global regoutfile, clear 
global regoutfile = "Table_heating.csv" 
eststo clear

eststo: reg heat_house_elec_   TGH_T_post TGL_T_post TGH_S_post TGL_S_post TGH_S  TGL_S  TGH_T TGL_T  post  i.hh_id,  cluster(within_village_cluster)
test TGH_T_post = TGL_T_post
test TGH_S_post = TGL_S_post  

eststo: reg   prop_rms_ht_   TGH_T_post TGL_T_post TGH_S_post TGL_S_post TGH_S  TGL_S  TGH_T TGL_T  post  i.hh_id,  cluster(within_village_cluster)
test TGH_T_post = TGL_T_post
test TGH_S_post = TGL_S_post  

eststo: reg   num_rms_ht_  TGH_T_post TGL_T_post TGH_S_post TGL_S_post TGH_S  TGL_S  TGH_T TGL_T  post  i.hh_id,  cluster(within_village_cluster)
test TGH_T_post = TGL_T_post
test TGH_S_post = TGL_S_post  

esttab using $regoutfile, keep(_cons post TGH_T_post TGL_T_post  TGH_S_post TGL_S_post ) $format $statsFEshort title("TABLE X: Outcome= Indirect Rebound ") replace 

